package com.eastfair.home.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.request.PageParams;
import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.service.HomeReportVenueDrawingCategoryAuditHistoryService;
import com.eastfair.venuebooking.api.ReportVenueDrawingCategoryAuditHistoryFeign;
import com.eastfair.venueservice.dto.ReportVenueDrawingCategoryAuditHistoryDTO;
import com.eastfair.venueservice.vo.ReportVenueDrawingCategoryAuditHistoryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 一键报馆图纸分类审核记录历史 service.
 *
 * @author dqq
 * @date 2022 /9/17
 */
@Service
@Slf4j
public class HomeReportVenueDrawingCategoryAuditHistoryServiceImpl implements HomeReportVenueDrawingCategoryAuditHistoryService {

    @Resource
    private ReportVenueDrawingCategoryAuditHistoryFeign reportVenueDrawingCategoryAuditHistoryFeign;

    @Override
    public Page<ReportVenueDrawingCategoryAuditHistoryVO> queryHistory(PageParams<ReportVenueDrawingCategoryAuditHistoryDTO> pageParams) {
        log.info("queryHistory - 报馆号查询图纸分类审核VO历史列表, pageParams={}", pageParams);
        R<Page<ReportVenueDrawingCategoryAuditHistoryVO>> result = reportVenueDrawingCategoryAuditHistoryFeign.queryHistory(pageParams);
        log.info("queryHistory - 完成, result={}", result);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}